import sqlobject
from coptur.database import *

class Port(sqlobject.SQLObject):

    _connection = connection.connect

    #name = sqlobject.StringCol(length=14, unique=True)
    #lastCall = sqlobject.DateTimeCol(default=None)
    port = sqlobject.IntCol()
    protocol = sqlobject.IntCol(default=0) # 0:tcp 1:udp
    services = sqlobject.StringCol(length=255)
    status = sqlobject.IntCol(default=0) # 0:open, 1:filted 2:vulnerable -1:closed
    banner = sqlobject.StringCol()
    host = sqlobject.ForeignKey('Host')

# create table if not exists
Port.createTable(ifNotExists=True)
